<form {{action "onSave" on="submit"}}>

  <div class="dataset-deprecation-toggle__toggle-header">

    <p class="dataset-deprecation-toggle__toggle-header__label">
      Is this dataset deprecated?
    </p>

    {{input
      id="dataset-is-deprecated"
      type="checkbox"
      title="Is this dataset deprecated?"
      class="toggle-switch toggle-switch--light"
      checked=(readonly deprecatedAlias)
      change=(action "toggleDeprecatedStatus")
    }}
    <label for="dataset-is-deprecated" class="toggle-button">
    </label>

  </div>

  {{#if deprecatedAlias}}

    {{medium-content-editable
      value=deprecationNoteAlias
      options=editorOptions
      class="comment-new__content"}}

    <h4 class="dataset-deprecation-header">When should this dataset be decommissioned?</h4>

    {{#power-calendar
      selected=selectedDate
      center=centeredDate
      class="dataset-deprecation-toggle__decommission-calendar"
      onSelect=(action "onDecommissionDateChange" value="date")
      onCenterChange=(action (mut centeredDate) value="date") as |calendar|}}

      <nav class="ember-power-calendar-nav">

        <button
          type="button"
          class="ember-power-calendar-nav-control"
          onclick={{action calendar.actions.moveCenter -1 'month'}}>
          &lt;
        </button>
        <div class="ember-power-calendar-nav-title">
          {{moment-format calendar.center 'MMMM YYYY'}}
        </div>
        <button
          type="button"
          class="ember-power-calendar-nav-control"
          onclick={{action calendar.actions.moveCenter 1 'month'}}>
          &gt;
        </button>
      </nav>

      {{calendar.days minDate=minSelectableDecommissionDate}}

    {{/power-calendar}}

    <p class="decommission-date {{unless decommissionDate 'decommission-date--required'}}">
      {{#unless decommissionDate}}
          Please specify a date when this dataset will be decommissioned
      {{/unless}}

      <strong>
        {{if decommissionDate (concat 'Will be decommissioned on ' (moment-format decommissionDate 'MMMM DD YYYY')) ''}}
      </strong>
    </p>

  {{/if}}

  <div class="dataset-deprecation-toggle__actions">
    <button
      type="submit"
      disabled={{and deprecatedAlias (not decommissionDate)}}
      class="nacho-button--large nacho-button--secondary">
      Update Deprecation Status
    </button>
  </div>
</form>
